package com.janwen.spring.datasource.router;

import javax.annotation.Resource;
import javax.sql.DataSource;

import org.springframework.jdbc.core.support.JdbcDaoSupport;

public class GenericDaoImpl extends JdbcDaoSupport implements GenericDao {

	@Resource(name="dataSource")
	public  void setDynamicDatasource(DataSource dataSource){
		super.setDataSource(dataSource);
	}
	@Override
	public Long getLastInsertId() {
		String sql = "select last_insert_id()";
		return getJdbcTemplate().queryForLong(sql);
	}

}
